
/**
 * Created by Shijie Liu
 * 2017.6.21
 * 购物车删除图书信息
 */

    function deleteshop(node) {
        var book_id =node.getAttribute("id");

        var xmlhttp;

        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                if (xmlhttp.responseText == 1) {
                    alert("删除成功！");
                    window.location.reload();
                } else{
                    alert("删除失败！");
                }
            }
        }
        xmlhttp.open("GET", "server/deleteshop.php?id=" + book_id , true);
        xmlhttp.send();

}

function clearCart() {

    var xmlhttp;

    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            if (xmlhttp.responseText == 1) {
                alert("清除成功！");
                location.reload();
            } else{
                alert("清除失败！");
            }
        }
    }
    xmlhttp.open("GET", "server/deleteCart.php", true);
    xmlhttp.send();

}
